import { createRouter, createWebHashHistory } from 'vue-router'
import Home from '../views/Home.vue'

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue'),
    children: [
      {
        path: 'rili',
        name: 'rili',
        component: () => import(/* webpackChunkName: "about" */ '../views/rili.vue'),
      },
      {
        path: 'glbanji',
        name: 'GLbanji',
        component: () => import(/* webpackChunkName: "about" */ '../views/GLbanji.vue')
      },
      {
        path: 'glkecheng',
        name: 'GLkecheng',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "about" */ '../views/GLkecheng.vue')
      },
      {
        path: 'glteacher',
        name: 'GLteacher',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "about" */ '../views/GLteacher.vue')
      },
      {
        path: 'gldenglu',
        name: 'GLdenglu',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "about" */ '../views/GLdenglu.vue')
      },
      {
        path: 'glstudent',
        name: 'GLstudent',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "about" */ '../views/GLstudent.vue')
      },
      {
        path: 'glluruxuesheng',
        name: 'GLluruxuesheng',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "about" */ '../views/GLluruxuesheng.vue')
      },
    ],
  },
  {
    path: '/student',
    name: 'Student',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/Student.vue'),
    children: [
      {
        path: 'srili',
        name: 'srili',
        component: () => import(/* webpackChunkName: "about" */ '../views/srili.vue'),
      },
      {
        path: 'chaxunchengji',
        name: 'Chaxunchengji',
        component: () => import(/* webpackChunkName: "about" */ '../views/Chaxunchengji.vue'),
      },
      {
        path: 'student_tongji',
        name: 'student_tongji',
        component: () => import(/* webpackChunkName: "about" */ '../views/student_tongji.vue'),
      },
    ]
  },
  {
    path: '/studentzhuce',
    name: 'Studentzhuce',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/Studentzhuce.vue')
  },
  {
    path: '/teacher',
    name: 'Teacher',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/Teacher.vue'),
    children: [
      {
        path: 'trili',
        name: 'trili',
        component: () => import(/* webpackChunkName: "about" */ '../views/trili.vue'),
      },
      {
        path: 'teacher_xueshengxinxi',
        name: 'teacher_xueshengxinxi',
        component: () => import(/* webpackChunkName: "about" */ '../views/teacher_xueshengxinxi.vue'),
      },
      {
        path: 'teacher_luruxuesheng',
        name: 'teacher_luruxuesheng',
        component: () => import(/* webpackChunkName: "about" */ '../views/teacher_luruxuesheng.vue'),
      },
      {
        path: 'teacher_banjitongji',
        name: 'teacher_banjitongji',
        component: () => import(/* webpackChunkName: "about" */ '../views/teacher_banjitongji.vue'),
      },
      {
        path: 'teacher_kechengtongjitu',
        name: 'teacher_kechengtongjitu',
        component: () => import(/* webpackChunkName: "about" */ '../views/teacher_kechengtongjitu.vue'),
      },
      {
        path: 'teacher_benbanchengji',
        name: 'teacher_benbanchengji',
        component: () => import(/* webpackChunkName: "about" */ '../views/teacher_benbanchengji.vue'),
      },
      {
        path: 'teacher_kechengchengji',
        name: 'teacher_kechengchengji',
        component: () => import(/* webpackChunkName: "about" */ '../views/teacher_kechengchengji.vue'),
      },
      {
        path: 'teacher_chaxunkecheng',
        name: 'teacher_chaxunkecheng',
        component: () => import(/* webpackChunkName: "about" */ '../views/teacher_chaxunkecheng.vue'),
      },
    ]
  },
  {
    path: '/teacherzhuce',
    name: 'Teacherzhuce',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/Teacherzhuce.vue')
  },
  // {
  //   path: '/glbanji',
  //   name: 'GLbanji',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/GLbanji.vue')
  // },
  // {
  //   path: '/glkecheng',
  //   name: 'GLkecheng',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/GLkecheng.vue')
  // },
  // {
  //   path: '/glteacher',
  //   name: 'GLteacher',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/GLteacher.vue')
  // },
  // {
  //   path: '/gldenglu',
  //   name: 'GLdenglu',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/GLdenglu.vue')
  // },
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})
// router.beforeEach((to, form, next) => {
//   // to表示将要访问的路径
//   // form表示从那个页面跳转而来
//   // next表示允许跳转到指定位置
//   if (to.path === '/studentzhuce') return next()
//   if (to.path === '/teacherzhuce') return next()
//   if (to.path == '/') {
//     next()
//   } else {
//     let vuex = this.$store.state.s_xuehao
//     if (vuex==null) {
//       next('/')
//     } else {
//       next()
//     }
//   }
// })
export default router
